<include file="Public/common1" />
<block name="css">
    <link rel="stylesheet" type="text/css" href="__CSS__/order_center/write_info.css">
</block>
<block name="content">
<form id="form">
    <ul class="navs clearfix">
          <li class="active" style="border-left: 1px solid #ddd;"><span class="icon">&#10004;</span><a>第一步<br/>选择线路</a></li>
          <li class="active"><span class="icon">&#10004;</span><a >第二步<br/>行程预览</a></li>
          <li class="active"><span class="icon">3</span><a >第三步<br/>游客信息录入</a></li>
          <li><span class="icon">4</span><a >订单详情预览</a></li>
    </ul>
    <div class="warp">
        <h4>线路信息</h4>
        <div class="path-info clearfix">
            <div class="col-xs-12 clearfix">
                <div class="col-xs-2">线路编号：</div>
                <div class="col-xs-2">{$line.line_sn}</div>
                <div class="col-xs-2">团号：</div>
                <div class="col-xs-2">{$line.group_num}</div>
                <div class="col-xs-2">供应商：</div>
                <div class="col-xs-2">{$line.supplier}</div>
                <input type="hidden" name="line_id" value="{$line['line_id']}" />

            </div>

            <div class="col-xs-12 clearfix">
                <div class="col-xs-2">线路名称：</div>
                <div class="col-xs-2">{$line.line_name}</div>
                <div class="col-xs-2">行程天数：</div>
                <div class="col-xs-2">{$line.travel_days}</div>
            </div>

            <div class="col-xs-12 clearfix">
                <div class="col-xs-2">出发日期：</div>
                <div class="col-xs-2"><input type="text" name="day" readonly class="form-control" value="{$day}"/></div>
                <!-- <div class="col-xs-2">团队类型：</div>
                <div class="col-xs-2">
                    <select>
                        <option>gfghfd</option>
                        <option></option>
                    </select>
                </div> -->
            </div>
            <div class="col-xs-12 clearfix">
                <div class="col-xs-2">价格：</div>
                <div class="col-xs-6">
                    <table class="table table-bordered">
                        <tr>
                            <th></th>
                            <th>成人价</th>
                            <!-- <th>老人价</th> -->
                            <th>儿童价</th>
                        </tr>
                        <tr>
                            <th>销售价</th>
                            <td>&#165;{$price.adult_price}</td>
                            <!-- <td>&#165;{//$price.oldman_price}</td> -->
                            <td>&#165;{$price.child_price}</td>
                        </tr>

                        <if condition="$_POST['visa_price']">
                            <tr id="visa">
                                <input type="hidden" name="visa" value="{$_POST['visa_price']}" />
                                <th>签证</th>
                                <td>&#165;{$_POST['visa_price']}</td>
                                <!-- <td>&#165;{//$_POST['visa_price']}</td> -->
                                <td>&#165;{$_POST['visa_price']}</td>
                            </tr>
                        </if>

                        <if condition="$insure">
                            <tr id="insure">
                                <input type="hidden" name="insure" value="{$insure.up_insure_id}" />
                                <th>{$insure.insure_name}</th>
                                <td>&#165;{$insure.now_adult_price}</td>
                                <!-- <td>&#165;{//$insure.now_adult_price}</td> -->
                                <td>&#165;{$insure.now_adult_price}</td>
                            </tr>
                        </if>

                        <!-- 附加产品 -->
                        <foreach item="v" name="product">
                            <tr class="product">
                                <input type="hidden" name="product[]" value="{$v.product_id}" />
                                <th>{$v['product_name']}</th>
                                <td>&#165;{$v.product_price}</td>
                                <!-- <td>&#165;{//$v.product_price}</td> -->
                                <td>&#165;{$v.product_price}</td>
                            </tr>
                        </foreach>
                        <tr>
                            <th>单人总价</th>
                            <td >&#165;<span id="adultBase">{$insure['adult_actual_cost'] + $product_price + $_POST['visa_price'] + $price['adult_price'] }</span></td>
                            <!-- <td>&#165;{//$insure['adult_actual_cost'] + $product_price + $_POST['visa_price'] + $price['oldman_price'] }</td> -->
                            <td id="">&#165;<span id="childBase">{$insure['child_actual_cost'] + $product_price + $_POST['visa_price'] + $price['child_price'] }</span></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>

        <h4>游客信息</h4>
        <div id="orderInfo" class="path-info clearfix">
            <div class="col-xs-12 clearfix ">
                <div class="col-xs-2">成人数量：</div>
                <div class="col-xs-2">
                    <div class="form-group">
                        <div class="input-group">
                          <div class="input-group-addon down">-</div>
                          <input type="number" name="adult_num" min="0"  value="0" class="text-center form-control" id="adultNum" placeholder="">
                          <div class="input-group-addon plus">+</div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-2">儿童数量：</div>
                <div class="col-xs-2">
                    <div class="form-group">
                        <div class="input-group">
                          <div class="input-group-addon down">-</div>
                          <input type="number" name="child_num" min="0"  value="0" class="text-center form-control" id="childNum" placeholder="">
                          <div class="input-group-addon plus">+</div>
                        </div>
                    </div>
                </div>
                <!-- <div class="col-xs-2">老人数量：</div>
                <div class="col-xs-2">
                    <div class="form-group">
                        <div class="input-group">
                          <div class="input-group-addon down">-</div>
                          <input type="number"  min="0"  value="0" class="text-center form-control" id="oldNum" placeholder="">
                          <div class="input-group-addon plus">+</div>
                        </div>
                    </div>
                </div> -->
            </div>
            <div class="col-xs-12 text-center clearfix" style="margin-bottom: 10px; padding-top: 0;">
                <button type="button" id="confirmPeopelNum" class="btn btn-primary">确认人数</button>
            </div>

            <h5>交通服务(成人价/儿童价)</h5>
            <div id="upGoTraffic" class="col-xs-12 sub-pd clearfix">
                <div class="col-xs-2">{$traffic_seat['standard']['go']['traffic_name']}(标准)(去)：</div>
                <div class="col-xs-10 pd-0">
                    <div class="col-xs-2 title" >{$traffic_seat['standard']['go']['seat_name']}<br/>(余<span class="text-danger">{$traffic_seat['standard']['go']['seat_num']}</span>位)</div>
                    <div class="col-xs-2 traffic-warp">
                        <div class="col-xs-6">
                            <input type="number" name="traffic[go][adult]"  disabled min="0" max="{$traffic_seat['standard']['go']['seat_num']}" placeholder="成人/位"  class="seat-go form-control" data-max="{$v['seat_num']}" >
                        </div>
                        <div class="col-xs-6">
                            <input type="number" name="traffic[go][child]"  disabled min="0" max="{$traffic_seat['standard']['go']['seat_num']}" placeholder="儿童/位"  class="seat-go form-control" data-max="{$traffic_seat['standard']['go']['seat_num']}" >
                        </div>
                    </div>
                </div>

                <div class="col-xs-2">{$traffic_seat['standard']['go']['traffic_name']}(可升级)(去)：</div>
                <div class="col-xs-10 pd-0">
                    <foreach name="traffic_seat['back']" key="k" item="v">
                        <div class="col-xs-2 title" >{$v['seat_name']}<br/><span class="text-danger">&#165;{$v['now_adult_price']}</span>/<span class="text-danger">&#165;{$v['now_child_price']}</span>(余<span class="text-danger">{$v['seat_num']}</span>位)</div>
                        <div class="col-xs-2 traffic-warp">
                            <div class="col-xs-6">
                                <input type="number" name="up_traffic[go][{$v['up_traffic_id']}][adult]"  disabled min="0" max="{$v['seat_num']}" placeholder="成人/位"  class="seats-go  form-control" data-max="{$v['seat_num']}"  data-price="{$v['now_adult_price']}" >
                            </div>
                            <div class="col-xs-6">
                                <input type="number" name="up_traffic[go][{$v['up_traffic_id']}][child]"  disabled min="0" max="{$v['seat_num']}" placeholder="儿童/位"  class="seats-go form-control" data-max="{$v['seat_num']}" data-price="{$v['now_child_price']}" >
                            </div>
                        </div>
                    </foreach>
                </div>
            </div>

            <div id="upBackTraffic" class="col-xs-12 sub-pd clearfix">
                <div class="col-xs-2">{$traffic_seat['standard']['back']['traffic_name']}(标准)(回)：</div>
                <div class="col-xs-10 pd-0">
                    <div class="col-xs-2 title" >{$traffic_seat['standard']['back']['seat_name']}<br/>(余<span class="text-danger">{$traffic_seat['standard']['back']['seat_num']}</span>位)</div>
                    <div class="col-xs-2 traffic-warp">
                        <div class="col-xs-6">
                            <input type="number" name="traffic[back][adult]"  disabled min="0" max="{$traffic_seat['standard']['back']['seat_num']}" placeholder="成人/位"  class=" form-control" data-max="{$v['seat_num']}" >
                        </div>
                        <div class="col-xs-6">
                            <input type="number" name="traffic[back][child]"  disabled min="0" max="{$traffic_seat['standard']['back']['seat_num']}" placeholder="儿童/位"  class=" form-control" data-max="{$traffic_seat['standard']['back']['seat_num']}" >
                        </div>
                    </div>
                </div>

                <div class="col-xs-2">{$traffic_seat['standard']['back']['traffic_name']}(可升级)(回)：</div>
                <div class="col-xs-10 pd-0">

                    <foreach name="traffic_seat['back']" key="k" item="v">
                        <div class="col-xs-2 title" >{$v['seat_name']}<br/><span class="text-danger">&#165;{$v['now_adult_price']}</span>/<span class="text-danger">&#165;{$v['now_child_price']}</span>(余<span class="text-danger">{$v['seat_num']}</span>位)</div>
                        <div class="col-xs-2 traffic-warp">
                            <div class="col-xs-6">
                                <input type="number" disabled name="up_traffic[back][{$v['up_traffic_id']}][adult]" min="0" max="{$v['seat_num']}" placeholder="成人/位"  class="seats-back  form-control" data-max="{$v['seat_num']}"  data-price="{$v['now_adult_price']}" >
                            </div>
                            <div class="col-xs-6">
                                <input type="number" disabled name="up_traffic[back][{$v['up_traffic_id']}][child]" min="0" max="{$v['seat_num']}" placeholder="儿童/位"  class="seats-back  form-control" data-max="{$v['seat_num']}" data-price="{$v['now_child_price']}" >
                            </div>
                        </div>
                    </foreach>
                </div>
            </div>

            <foreach name="hotel" key="k" item="v">

                <div class="col-xs-12 clearfix">
                    <h5>day{$k}—酒店服务</h5>
                    <div class="col-xs-12 clearfix day-hotel">
                        <!-- 可选入住酒店 -->
                        <foreach name="v['room']" key="kk" item="vv">
                            <div class="col-xs-2"><if condition="$kk == 0">可选入住酒店</if></div>
                            <div class="col-xs-10 pd-0 standard-hotel">
                                <div class="hotel-warp">
                                    <div class="col-xs-2" >{$vv['supplier_name']}({$vv['room_name']})<br/><span class="notes">(余<span class="text-danger">{$vv['room_count']}</span>间)</span></div>
                                    <div class="col-xs-2">
                                        <div class="col-xs-6">
                                            <input type="number" name="hotel[{$k}][{$vv['room_priceId']}]" disabled min="0" max="{$vv['room_count']}" placeholder="" data-uNum="{$vv['user_count']}" class="hotel form-control" data-max="{$vv['room_count']}"/>
                                        </div>
                                        <div class="col-xs-6 add-room"><button type="button" onclick="addRoom(this)" disabled class="btn btn-primary add-room-btn">添加房间</button></div>
                                        <!-- <div class="col-xs-6"><input type="number" disabled min="0" placeholder="儿童/位"  class="seats form-control" data-max="{$vv['room_count']}" data-child="{$v['now_child_price']}"   ></div> -->
                                    </div>
                                </div>
                            </div>
                        </foreach>

                        <!-- 可选升级酒店 -->
                        <div class="col-xs-2">可选升级酒店</div>
                        <div class="col-xs-10 pd-0 ">
                            <foreach name="v['upgrade']" item="vv">
                                <div class="col-xs-2" >
                                {$vv['supplier_name']}({$vv['room_name']})<br/>
                                <span class="text-danger">&#165;{$vv['now_adult_price']}</span><!-- /<span class="text-danger">&#165;{$vv['now_child_price']}</span> -->(余<span class="text-danger">{$vv['room_count']}</span>间)
                                </div>
                                <div class="col-xs-2">
                                    <div class="col-xs-6"><input type="number" disabled name="up_hotel[{$k}][{$vv['up_hotel_id']}]" min="0" max="{$vv['room_count']}" placeholder="" data-uNum="{$vv['user_count']}" class="up-hotel form-control" data-max="{$vv['room_count']}"  data-actual="{$vv['now_adult_price']}" ></div>
                                    <!-- <div class="col-xs-6"><input type="number" disabled min="0" placeholder="儿童/位"  class="seats form-control" data-max="{$vv['room_count']}" data-child="{$v['now_child_price']}"   ></div> -->
                                </div>
                            </foreach>
                        </div>
                        <div class="col-xs-12 text-right pull-left add-price" >当日需补房差：&#165;<span class="text-danger addPrice">0</span></div>
                    </div>

                </div>
            </foreach>
        </div>

        <table class="table table-striped  table-bordered table-hover table-condensed ">
                <thead>
                    <tr>
                        <th width="80">序号</th>
                        <th width="80">设为联系人</th>
                        <th width="300">游客资料</th>
                        <th>备注</th>
                    </tr>
                </thead>
                <tbody id="touristInfo">
                    <tr class="tourist-info">
                        <td class="add" id="add" >+</td>
                        <td><input type="radio" value="0" checked name="tourist[contenct]"/></td>
                        <td class="clearfix">
                            <div class="col-xs-12">
                                <label for="" class="col-xs-4">姓名</label>
                                <div class="col-xs-8"><input type="text" required name="tourist[0][name]" class="form-control touristName" /></div>
                                <label for="" class="col-xs-4">性别</label>
                                <div class="col-xs-8">
                                    <select name="tourist[0][sex]">
                                        <option value="1">男</option>
                                        <option value="2">女</option>
                                    </select>
                                </div>
                                <label for="" class="col-xs-4">年龄</label>
                                <div class="col-xs-8">
                                    <select name="tourist[0][tourists_type]">
                                        <option value="1">成人</option>
                                        <option value="2">老人</option>
                                        <option value="3">小孩</option>
                                    </select>
                                </div>
                                <label for="" class="col-xs-4">证件</label>
                                <div class="col-xs-8">
                                    <select name="tourist[0][documents_type]">
                                        <option value="1" selected>身份证</option>
                                    </select>
                                </div>
                                <label for="" class="col-xs-4">证件号</label>
                                <div class="col-xs-8"><input type="number" name="tourist[0][documents_num]" disabled min="0"  class="form-control card" /></div>
                                <label for="" class="col-xs-4">手机号码</label>
                                <div class="col-xs-8"><input type="number" name="tourist[0][tourists_phone]" disabled min="0"  class="form-control phone" /></div>
                            </div>
                        </td>
                        <td>
                            <textarea rows="10" name="tourist[0][tourists_remarks]" class="form-control"></textarea>
                        </td>
                    </tr>
                </tbody>
        </table>
        <!-- 下单订单信息 -->
        <div  class="path-info clearfix">

        <if condition="$line['discounts_condition']">
            <div class="col-xs-12 clearfix text-right">
                <span class="text-right bolder ">订单优惠：</span>
                    <select name="discounts" id="discounts" disabled>
                        <option value="0">不使用优惠</option>
                        <option value="{$line['discounts']}" >满{$line['discounts_condition']}人减{$line['discounts']}</option>
                    </select>
            </div>
        </if>

        <div class="col-xs-12 text-right clearfix bolder">
            订单总额：<span  class="point">&#165;<span id="orderTotalPrice">0</span></span>
        </div>

        <!-- 订单备注 -->
        <div class="col-xs-12 clearfix">
            <div class="col-xs-2">订单备注：</div>
            <div class="col-xs-10">
                <textarea name="order_remarks" id="" cols="30" rows="5" class="form-control" placeholder="备注销售优惠明细"></textarea>
            </div>
        </div>

        <div class="col-xs-12 clearfix">
            <div class="col-xs-2">验证码：</div>
            <div class="col-xs-2">
                <input type="text" name="verify" placeholder="请输入验证码" class="form-control" />

            </div>
            <div class="col-xs-8">
                <img id="verify"  src="{:U('OrderCenter/showCode')}"/> <span class="text-danger">点击图片更换验证码</span>
            </div>
        </div>
        <div class="col-xs-12 text-center "><input type="button" id="submit" disabled value="支付" class="btn btn-primary btn-large"/></div>
    </div>
    </div>
</form>

</block>
<block name="js">
<script type="text/javascript">
// 更换图片验证码
$('#verify').on('click', function(){ $(this).attr('src', "{:U('OrderCenter/showCode')}"); })
var uCount = parseInt( {$hotel[1]['room'][0]['user_count'] | default = 0} ),
addRoomPrice = parseFloat( {$line['add_room_price'] | default = 0});

//优惠变动
$('#discounts').on('change', function(){
    if($(this).val()){
        if( {$line['discounts_condition'] | default=0} > parseInt( orderPeopleNum ) ){
            layer.alert('人数未达到订单优惠条件');
            $(this).find('option').eq(0).prop('selected', true);
            return false;
        }
        changeOrderPrice();
    }
})
</script>
<script src="__JS__/order_center/write_info.js"></script>
</block>
